package demo1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 98152
 * Date: 2024-07-08
 * Time: 14:56
 */
public class Test {
    public static void main2(String[] args) {
        MySingleList mySingleList = new MySingleList();
        mySingleList.addLast(15);
        mySingleList.addLast(34);
        mySingleList.addLast(25);
        mySingleList.addLast(12);
        mySingleList.addLast(4);
        MySingleList.ListNode listNode = mySingleList.partition(20);
        mySingleList.display();
    }
    public static void main(String[] args) {
        MyLinkedList myLinkedList = new MyLinkedList();
        /*myLinkedList.addFirst(1);
        myLinkedList.addFirst(2);
        myLinkedList.addFirst(3);
        myLinkedList.addFirst(4);
        myLinkedList.addFirst(5);
        myLinkedList.display();//5 4 3 2 1
        myLinkedList.addLast(45);
        myLinkedList.addLast(7);
        myLinkedList.addLast(9);
        myLinkedList.addLast(58);
        myLinkedList.display();//5 4 3 2 1 45 7 9 58
        System.out.println(myLinkedList.size());//9
        System.out.println(myLinkedList.contains(5));//true
        myLinkedList.addIndex(0, 6);//6 5 4 3 2 1 45 7 9 58
        myLinkedList.addIndex(myLinkedList.size(), 99);//6 5 4 3 2 1 45 7 9 58 99
        myLinkedList.addIndex(2, 18);//6 5 18 4 3 2 1 45 7 9 58 99
        myLinkedList.addIndex(6, 10);//6 5 18 4 3 2 10 1 45 7 9 58 99
        myLinkedList.display();
        myLinkedList.remove(6);
        myLinkedList.display();//5 18 4 3 2 10 1 45 7 9 58 99
        myLinkedList.remove(99);
        myLinkedList.display();//5 18 4 3 2 10 1 45 7 9 58
        myLinkedList.remove(4);
        myLinkedList.display();//5 18 3 2 10 1 45 7 9 58*/
        myLinkedList.addFirst(1);
//        myLinkedList.remove(1);
//        myLinkedList.display();
//        System.out.println("====");
        myLinkedList.addFirst(1);
        myLinkedList.addFirst(1);
        myLinkedList.addFirst(5);
        myLinkedList.addFirst(4);
        myLinkedList.addFirst(15);
        myLinkedList.addFirst(23);
        myLinkedList.addFirst(1);
        myLinkedList.addFirst(1);
        myLinkedList.addFirst(1);
        myLinkedList.display();
        myLinkedList.removeAllKey(1);
        myLinkedList.display();
        myLinkedList.clear();
        myLinkedList.display();
        System.out.println("=======");
    }
    public static void main1(String[] args) {
        MySingleList list = new MySingleList();
        list.creatList();
        list.display();//0 1 2 3
        list.addFirst(12);
        list.display();//12 0 1 2 3
        list.addLast(45);
        list.display();//12 0 1 2 3 45
        System.out.println(list.size());//6
        list.addIndex(6,88);//12 88 0 1 2 3 45 88
        list.display();
        System.out.println(list.contains(45));//true
        list.remove(12);
        list.display();//0 1 2 3 45 88
        list.addFirst(45);
        list.addLast(3);
        list.display();//45 0 1 2 3 45 88 3
        list.removeAllKey(45);
        list.display();//0 1 2 3 88 3
        list.removeAllKey(3);
        list.display();//0 1 2 88
        list.clear();
        System.out.println("=====");
        list.display();

        list.addFirst(12);
        list.addFirst(12);
        list.addFirst(14);
        list.addFirst(12);
        list.addFirst(12);
        list.display();//12 12 14 12 12
        list.removeAllKey(12);
        list.display();
    }
}
